package com.cts.rt.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cts.rt.dao.EmployeeLevelDao;
import com.cts.rt.model.EmployeeLevel;
import com.cts.rt.service.EmployeeLevelManager;

/**
 * Implementation of RoleManager interface.
 *
 * @author <a href="mailto:dan@getrolling.com">Dan Kibler</a>
 */
@Service("employeeLevelManager")
public class EmployeeLevelManagerImpl extends GenericManagerImpl<EmployeeLevel, Long> implements EmployeeLevelManager {
    EmployeeLevelDao employeeLevelDao;

    @Autowired
    public EmployeeLevelManagerImpl(EmployeeLevelDao employeeLevelDao) {
        super(employeeLevelDao);
        this.employeeLevelDao = employeeLevelDao;
    }

    /**
     * {@inheritDoc}
     */
    public List<EmployeeLevel> getLevels(EmployeeLevel role) {
        return dao.getAll();
    }

    /**
     * {@inheritDoc}
     */
    public EmployeeLevel getEmployeeLevel(String rolename) {
        return employeeLevelDao.getLevelByName(rolename);
    }

    /**
     * {@inheritDoc}
     */
    public EmployeeLevel saveEmployeeLevel(EmployeeLevel role) {
        return dao.save(role);
    }

    /**
     * {@inheritDoc}
     */
    public void removeEmployeeLevel(String name) {
    	employeeLevelDao.removeEmployeeLevel(name);
    }
}